<!DOCTYPE html>
<html>
  <head>
    <script src="https://cdn.rawgit.com/deepstreamIO/deepstream.io-client-js/master/dist/deepstream.min.js"></script>
  </head>
  <body>
    <input type="text" />
    <script type="text/javascript">
      var client = deepstream('localhost:6020');
      client.on('error', function (error, event, topic) {
        console.log(error, event, topic);
      });
      client.on('connectionStateChanged', connectionState => {
      	console.log("connection state: " + connectionState);
      })
      client.login({ username: 'userA', password: 'password' }, function (success, data) {
      	if(success)
      	{
      		console.log("login successful", data);
          var answers = []; var count=1;
          for(let i=0; i < 10000; ++i)
          {
            client.rpc.make('echo', "", (err, result) => {
              //console.log("result: ", i, result);
              if(err) console.log(i, err);
              else 
                answers[i] = result;

              if(++count > 9998) console.log(answers);
            });            
          }
      	}
      	else
      	{

      	}
      });
    </script>
  </body>
</html>